package com.eudon.design_pattern.structural.facade.system_b;

import com.eudon.design_pattern.structural.facade.system_a.UserAndWalletService;
import com.eudon.design_pattern.structural.facade.system_a.UserService;
import com.eudon.design_pattern.structural.facade.system_a.WalletService;

/**
 * @author eudon
 * @description system_b调用system_a提供的创建用户和钱包功能
 * @date 2025/9/2
 * @email syd19970616@gmail.com
 * @address <a href="https://gitee.com/eudon">Gitee</a>
 */
public class Use {
    public static void main(String[] args) {
        //1.采用门面模式之前的客户端调用system b
        before("eudon","111111");

        //2.采用门面模式之后的客户端调用system b
        after("eudon","111111");
    }

    private static void before(String username, String password) {
        UserService userService = new UserService();
        Long user = userService.createUser(username, password);
        new WalletService().createUserWallet(user);
    }

    private static void after(String username, String password) {
        UserAndWalletService service = new UserAndWalletService(new UserService(),new WalletService());
        service.createUserAndWallet(username, password);
    }
}
